package com.rc.evcharger.rabbit.queue;

import com.rc.evcharger.common.config.RabbitListenerConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.CustomExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 交换器绑定队列与KEY
 */
@Configuration
public class Domain2QueueConfig {

    //===============以下是验证direct Exchange的队列==========
    @Bean
    //@Qualifier(value = "domain2A1Queue")
    public Queue domain2A1Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_A1_QUEUE);
    }

    @Bean
    public Queue domain2A2Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_A2_QUEUE);
    }

    @Bean
    public Queue domain2A4Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_A4_QUEUE);
    }

    @Bean
    public Queue domain2A5Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_A5_QUEUE);
    }

    @Bean
    public Queue domain2A6Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_A6_QUEUE);
    }

    //@Bean
    //public Queue domain2CardNoQueue() {
    //    return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_CARDNO_QUEUE);
    //}

    @Bean
    public Queue domain20EQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_0E_QUEUE);
    }

    @Bean
    public Queue domain21CQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_1C_QUEUE);
    }

    @Bean
    public Queue domain28CQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_8C_QUEUE);
    }

    @Bean
    public Queue domain28EQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_8E_QUEUE);
    }

    @Bean
    public Queue domain28EDelayQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_8E_DELAY_STOP_QUEUE);
    }

    @Bean
    public Queue domain233Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_33_QUEUE);
    }

    @Bean
    public Queue domain279Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_79_QUEUE);
    }

    @Bean
    public Queue domain289Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN2_CONTROLL_89_QUEUE);
    }

    //@Bean
    //public Queue chargeLogQueue() {
    //    return new Queue(RabbitListenerConstant.DOMAIN_LOG_CHARGED_PROCESS_QUEUE);
    //}

    /*
    ***********************************todo 建立绑定关系***************************************************
    *
    * */

    @Bean
    public Binding domain2A1Binding(CustomExchange customExchange){
        return BindingBuilder.bind(domain2A1Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_A1_QUEUE).noargs();
    }

    @Bean
    public Binding domain2A2Binding(CustomExchange customExchange){
        return BindingBuilder.bind(domain2A2Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_A2_QUEUE).noargs();
    }

    @Bean
    public Binding domain2A4Binding(CustomExchange customExchange){
        return BindingBuilder.bind(domain2A4Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_A4_QUEUE).noargs();
    }

    @Bean
    public Binding domain2A5Binding(CustomExchange customExchange){
        return BindingBuilder.bind(domain2A5Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_A5_QUEUE).noargs();
    }

    @Bean
    public Binding domain2A6Binding(CustomExchange customExchange){
        return BindingBuilder.bind(domain2A6Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_A6_QUEUE).noargs();
    }

    //@Bean
    //public Binding domain2CardNoBinding(CustomExchange customExchange){
    //    return BindingBuilder.bind(domain2CardNoQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_CARDNO_QUEUE).noargs();
    //}

    @Bean
    public Binding domain20EBinding(CustomExchange customExchange){
        return BindingBuilder.bind(domain20EQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_0E_QUEUE).noargs();
    }

    @Bean
    public Binding domain21CBinding(CustomExchange customExchange){
        return BindingBuilder.bind(domain21CQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_1C_QUEUE).noargs();
    }

    @Bean
    public Binding domain28CBinding(CustomExchange customExchange){
        return BindingBuilder.bind(domain28CQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_8C_QUEUE).noargs();
    }

    @Bean
    public Binding domain28EBinding(CustomExchange customExchange){
        return BindingBuilder.bind(domain28EQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_8E_QUEUE).noargs();
    }

    @Bean
    public Binding domain28EDelayBinding(CustomExchange customExchange){
        return BindingBuilder.bind(domain28EDelayQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_8E_DELAY_STOP_QUEUE).noargs();
    }

    @Bean
    public Binding domain233Binding(CustomExchange customExchange){
        return BindingBuilder.bind(domain233Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_33_QUEUE).noargs();
    }

    @Bean
    public Binding domain279Binding(CustomExchange customExchange){
        return BindingBuilder.bind(domain279Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_79_QUEUE).noargs();
    }

    @Bean
    public Binding domain289Binding(CustomExchange customExchange){
        return BindingBuilder.bind(domain289Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN2_CONTROLL_89_QUEUE).noargs();
    }

    //@Bean
    //public Binding domain2ChargeLogBinding(Queue chargeLogQueue,CustomExchange customExchange){
    //    return BindingBuilder.bind(chargeLogQueue).to(customExchange).with(RabbitListenerConstant.DOMAIN_LOG_CHARGED_PROCESS_QUEUE).noargs();
    //}



}
